# OpenAPI version identifier - required for OpenAPI 3.0 domains
# (c) Elexon 2022, 2023
#
# MMHS - Data Integration Platform 
# ECS Reports 
# 
# ----- update -----------------------------------------------------------------------
# September 2023
# Aligned to version 1.5
#
# ------------------------------------------------------------------------------------
# Change history
# ====================================================================================
# Ver   Date           Ref.    Description
# ------------------------------------------------------------------------------------
#
# 0.1 - Sept 2023  -  Created from v1.5 Interfaces module as a result of DIN 650 -
#                      Introduction of Compressed Payloads into DIP Messages
#                     DIN-659 - Add R007 to REP007
#                     DIN-655 
# ====================================================================================
# # OpenAPI version identifier - required for OpenAPI 3.0 domains
openapi: 3.0.0

#######################
# Optional info section
#######################
info:
  title: ECS Reports
  description: ECS Data defintion Common components and examples
  version: '1.5'

components:

  ####################
  # Common data models
  ####################
  schemas:


# REP-002 Supplier report for DUOS - aggregated data

    REP-002-CustomBlock:
      description: REP002 Custom data block - Supplier report for DUOS - aggregated data
      type: object
      additionalProperties:
          false        
      properties:
        R007:
            #    Settlement Run Execution  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R007'
        R002:
            #    Settlement Run Execution  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R002'
        R009:
            #    Supplier MPID   
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R009'
        R027:
            #   Distributor ID 
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R9007'


# REP-002A - Embedded Network report for DUoS – aggregated data

    REP-002A-CustomBlock:
      description: REP002A Custom data block - Embedded Network report for DUoS – aggregated data
      type: object
      additionalProperties:
          false        
      properties:
        R027:
            #    Distributor ID 
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R027'
        R013:
            #    GSP Group  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R013'
        R007:
            #    Settlement Run Execution  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R007'
        R002:
            #    Settlement Run Execution  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R002'
        R006List:
          description: array of Embedded LDSOs
          type: array
          items:
              $ref:  'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R9006'

              
# REP-002B LDSO report for DUOS - aggregated data - new for release 1.5 (9/2023), REP-002 has been split into REP-002 
#                                 (supplier) and REP-002B (LDSO)

    REP-002B-CustomBlock:
      description: REP002 Custom data block - LDSO report for DUOS - aggregated data
      type: object
      additionalProperties:
          false        
      properties:
        R007:
            #    Settlement Run Execution  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R007'
        R002:
            #    Settlement Run Execution  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R002'
        R009:
            #    Supplier MPID   
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R9009'




# REP003 - BM Unit Allocated Demand Volumes to Suppliers

    REP-003-CustomBlock:
      description: REP003 Custom data block
      type: object
      additionalProperties:
          false        
      properties:
        R013:
            #    GSP Group  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R013'
        R007:
            #    Settlement Run Execution  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R007'
        R002:
            #    Settlement Run Info  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R002'
        R103:
            #    Settlement Period Duration  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R103'
 
        R015List:
          description : Supplier(s)
          type: array
          items:
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R9015'

        R024List: 
          description: GSP Group correction factors
          type: array
          items:
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R024'
          


# REP004 - Supplier Deemed Take Report


    REP-004-CustomBlock:
      description: REP004 Custom data block
      type: object
      additionalProperties:
          false        
      properties:
        R013:
            #    GSP Group  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R013'
        R007:
            #    Settlement Run Execution  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R007'
        R002:
            #    Settlement Run Info 
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R002'
        R009:
            #    Supplier  ID
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R009'
        R026List:
          type: array
          items:
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R026'
        R025List: 
          type: array
          items:
            #   Daily Supplier Deemed Take
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R025'
            

# REP006 - Aggregated Uncorrected volumes by CCC to Market Participants

    REP-006-CustomBlock:
      description: REP006 Custom data block
      type: object
      additionalProperties:
          false        
      properties:
        R013:
            #    GSP Group  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R013'
        R007:
            #    Settlement Run Execution  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R007'
        R002:
            #    Settlement Run Execution  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R002'
        R032List:
          description: Array of extended BM Unit records 
          type: array
          items:
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R9032'


# REP007 - VAS Exception Report to Suppliers

    REP-007-CustomBlock:
      description: REP007 Custom data block
      type: object
      additionalProperties:
          false        
      properties:
        R007:
            #    Settlement Run Execution  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R007'
        R002:
            #    Settlement Run Info
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R002'
        R013List:
          type: array
          items:
            #    GSP Group ext  
            $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R9013'


# REP008 -  MDS Exception Report to LDSOs

    REP-008-CustomBlock:
      description: REP008 Custom data block
      type: object
      additionalProperties:
          false        
      properties:
          R002:
              #    Settlement Run Execution  
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R002'
          R013:
              #    GSP Group  
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R013'
          R027:
              # Distributor ID
              $ref:  'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R027'
          R039:
              # LLF Default Data Detail
              $ref:  'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R039'
              
# REP009 Half Hourly metered data for Suppliers that is used by the CM Settlement Services Provider in calculating CM data, and/ or by the CFD Settlement Services provider in calculating CFD data.


  
    REP-009-CustomBlock:
        description: REP009 Custom data block
        type: object
        additionalProperties:
            false        
        properties:
          R002:
              #    Settlement Run Execution  
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R002'
          R9015a:
              # Supplier ID
              $ref:  'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R9015a'

  # REP900 
  

  
    REP-900-CustomBlock:
        description: REP900 Custom data block
        type: object
        additionalProperties:
            false        
        properties:
          R900-01:
              # LDSO Billing Distributor Info   
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R900-01'
          R900-02:
              #   LDSO Billing Supplier Info  
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R900-02'
          R900-03:
              #  LDSO Billing Site Info
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R900-03'
          R900-04:
              #  Invoice Data  
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R900-04'
          B900-05List:
            description: Invoice Lines
            type : array
            items: 
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R900-05'
              
  # REP901 

    REP-901-CustomBlock:
        description: REP901 Custom data block
        type: object
        additionalProperties:
            false        
        properties:
          R901-01:
              # DIS/GSP    
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R901-01'
          R901-02:
              #   Settlement Run  
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R901-02'
  
          R901-03:
              #   Settlement Date
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R901-03'
          
          R901-04:
              #   Supplier Id  
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R901-04'
              

              
          R901-05:
              #   Daily Total 
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R901-05'    
              
              
          R901-06:
              #   Tariff
              $ref: 'https://api.swaggerhub.com/domains/MHHSPROGRAMME/RealCommonBlocks/1.5#/components/schemas/R901-06'